<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Msgonline extends CI_Controller {

	private $tab = 'system';
	function __construct(){
		parent::__construct();
		/** 登陆验证 */
		if(!isset($_SESSION)){
		    session_start();
		}
		$admin = $this->session->userdata('admin_user');
		if(!$admin || !isset($admin['user_id'])){
			header('Location: /ychadmin/login');
			exit;
		}
	}
	
	
	public function index(){		
		$emailTxt = filePath('config/emailtxt');
		$vdata['emailtxt']= de_xie($emailTxt);
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'msgemail';
		$this->load->view('/ychadmin/msgonline', $vdata);
	}
	
	
	public function templetsave(){
		$email = array();
		$email['regsuccess'] = $_POST['regsuccess'];
		$email['findPwdMail'] = $_POST['findPwdMail'];
		$email['findPaypwdMail'] = $_POST['findPaypwdMail'];
		
		filePath("emailtxt",$email,'config/');

		$ret = array('msg'=>'操作成功');
		echo json_encode($ret);
		exit; 
		
	}
	
	public function msgsms(){
		$smsTxt = filePath('config/smstxt');
		$vdata['smstxt']= de_xie($smsTxt);
		$vdata['tab'] = $this->tab;
		$vdata['sub'] = 'msgsms';
		$this->load->view('/ychadmin/msgonline_sms', $vdata);
	}
	
	
	public function templetsmssave(){
		$sms = array();
		//$sms['payonline'] = $_POST['payonline'];
		//$sms['payback'] = $_POST['payback'];
		$sms['withdraw'] = $_POST['withdraw'];
		$sms['vip'] = $_POST['vip'];
		$sms['firstV'] = $_POST['firstV'];
		$sms['approve'] = $_POST['approve'];
		$sms['verify_phone'] = $_POST['verify_phone'];
		filePath("smstxt",$sms,'config/');
		$this->msgsms();
	}
	
}



